<template>
  <div>
    <p @click="changeColor" :style="{'background' : colors}">改变颜色</p>
  </div>
</template>

<script>
export default {
 data () {
  return {
   colors:''
  }
 },
  methods: {
    changeColor() {
       this.colors = `rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})`
    },
  },
};
</script>

<style>
</style>